<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="JavaScript">
	function getDetails(articleid) {
		document.getElementById("details").value=articleid;
	}
</script>

<title>Welcome</title>
</head>
<body>
	<s:if test="#session.loggedin != 'true'">
            <jsp:forward page="/index.jsp" />
    </s:if>
<h1>Author: <s:property value="#session.user.getName()" /> <s:property value="#session.user.getSecondName()" /></h1>
<hr>

<h4>Notifications: <s:property value="notifications" /> </h4>
<hr>
<jsp:include page="header.jspf"></jsp:include>
<hr>

<br />
<h4>Send publication</h4>
<s:form action="sendpublications">
<s:textfield name="publicationname" label="Title"/>
<s:textarea name="comentarticle" label="Comment" cols="30" rows="5"/>
<s:textfield name="tag" label="Tag" />
<s:submit value="Send" />
<s:checkbox name="checkvip" label="Send as VIP"/>

</s:form>

<hr>
<h4>Get My Publications</h4>
<s:form action="getpublications">
<s:submit value="Get publications" />
<s:if test="results==true">
	<table border="1">
	<tr><td><b>Article Id</b></td><td><b>Title</b></td><td><b>Date</b></td><td><b>Your comment</b></td><td><b>State</b></td><td><b>Mark</b></td><td><b>Link</b></td></tr>
			<s:iterator value="publications" status="itStatus">
				<tr><td><s:property value="getId()" /></td><td><s:property value="getTitle()" /></td><td><s:property value="getPublishing_date()" /></td><td><s:property value="getComment_author()" /></td><td><s:property value="getState()" /></td><td><s:property value="getMark()" /></td><td><a href="javascript:getDetails('<s:property value="getId()" />')">Details</a></td></tr>
			</s:iterator>
		</table>
</s:if>
<s:else>
<h5>There is no articles</h5>
</s:else>
</s:form>
<br />
<s:form action="articledetails">
<s:textfield name="articleid" id="details" label="Article ID"  />
<s:submit value="View Details" />
</s:form>

</body>
</html>